{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-10-19T10:59:49.847347Z",
     "start_time": "2020-10-19T10:59:48.316062Z"
    }
   },
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import torch\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-10-19T11:12:51.231269Z",
     "start_time": "2020-10-19T11:12:42.247436Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Downloading http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz to ./dataset/mnist/MNIST/raw/train-images-idx3-ubyte.gz\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100.1%"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Extracting ./dataset/mnist/MNIST/raw/train-images-idx3-ubyte.gz to ./dataset/mnist/MNIST/raw\n",
      "Downloading http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz to ./dataset/mnist/MNIST/raw/train-labels-idx1-ubyte.gz\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "113.5%"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Extracting ./dataset/mnist/MNIST/raw/train-labels-idx1-ubyte.gz to ./dataset/mnist/MNIST/raw\n",
      "Downloading http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz to ./dataset/mnist/MNIST/raw/t10k-images-idx3-ubyte.gz\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100.4%"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Extracting ./dataset/mnist/MNIST/raw/t10k-images-idx3-ubyte.gz to ./dataset/mnist/MNIST/raw\n",
      "Downloading http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz to ./dataset/mnist/MNIST/raw/t10k-labels-idx1-ubyte.gz\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "180.4%"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Extracting ./dataset/mnist/MNIST/raw/t10k-labels-idx1-ubyte.gz to ./dataset/mnist/MNIST/raw\n",
      "Processing...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/root/anaconda3/envs/mytorch/lib/python3.8/site-packages/torchvision/datasets/mnist.py:469: UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at  /opt/conda/conda-bld/pytorch_1595629434582/work/torch/csrc/utils/tensor_numpy.cpp:141.)\n",
      "  return torch.from_numpy(parsed.astype(m[2], copy=False)).view(*s)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Done!\n"
     ]
    }
   ],
   "source": [
    "import torchvision\n",
    "train_set=torchvision.datasets.MNIST(root='./dataset/mnist',train=True,download=True)\n",
    "test_set=torchvision.datasets.MNIST(root='./dataset/mnist',train=False,download=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-10-19T11:37:23.196580Z",
     "start_time": "2020-10-19T11:37:23.188887Z"
    }
   },
   "outputs": [],
   "source": [
    "import torch.nn.functional as F\n",
    "\n",
    "class LogisticRegressionModel(torch.nn.Module):\n",
    "    def __init__(self):\n",
    "        super(LogisticRegressionModel,self).__init__()\n",
    "        self.linear=torch.nn.Linear(1,1)\n",
    "    def forward(self,x):\n",
    "        y_pred=F.sigmoid(self.linear(x))\n",
    "        return y_pred\n",
    "model=LogisticRegressionModel()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-10-19T11:48:33.143532Z",
     "start_time": "2020-10-19T11:48:33.138206Z"
    }
   },
   "outputs": [],
   "source": [
    "criterion=torch.nn.BCELoss(size_average=False)\n",
    "optimizer=torch.optim.SGD(model.parameters(),lr=0.01)\n",
    "x_data=torch.Tensor([[1.],[2.],[3.]])\n",
    "y_data=torch.Tensor([[0],[0],[1]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-10-19T11:48:36.887991Z",
     "start_time": "2020-10-19T11:48:36.270883Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/root/anaconda3/envs/mytorch/lib/python3.8/site-packages/torch/nn/functional.py:1625: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.\n",
      "  warnings.warn(\"nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.\")\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 2.594923496246338\n",
      "1 2.569035530090332\n",
      "2 2.5444223880767822\n",
      "3 2.521042823791504\n",
      "4 2.498853921890259\n",
      "5 2.477811098098755\n",
      "6 2.4578702449798584\n",
      "7 2.4389853477478027\n",
      "8 2.4211113452911377\n",
      "9 2.404202461242676\n",
      "10 2.388213872909546\n",
      "11 2.3731002807617188\n",
      "12 2.3588180541992188\n",
      "13 2.3453240394592285\n",
      "14 2.332575798034668\n",
      "15 2.32053279876709\n",
      "16 2.309154510498047\n",
      "17 2.298402786254883\n",
      "18 2.288240909576416\n",
      "19 2.2786331176757812\n",
      "20 2.269545793533325\n",
      "21 2.260946273803711\n",
      "22 2.252802848815918\n",
      "23 2.245087146759033\n",
      "24 2.2377710342407227\n",
      "25 2.230827569961548\n",
      "26 2.2242321968078613\n",
      "27 2.217961311340332\n",
      "28 2.2119927406311035\n",
      "29 2.206305742263794\n",
      "30 2.200880527496338\n",
      "31 2.1956987380981445\n",
      "32 2.1907432079315186\n",
      "33 2.18599796295166\n",
      "34 2.181447982788086\n",
      "35 2.177079200744629\n",
      "36 2.1728782653808594\n",
      "37 2.1688337326049805\n",
      "38 2.164933204650879\n",
      "39 2.1611671447753906\n",
      "40 2.157525062561035\n",
      "41 2.1539978981018066\n",
      "42 2.150578022003174\n",
      "43 2.14725661277771\n",
      "44 2.144026756286621\n",
      "45 2.1408817768096924\n",
      "46 2.137815475463867\n",
      "47 2.134821891784668\n",
      "48 2.1318957805633545\n",
      "49 2.1290321350097656\n",
      "50 2.1262264251708984\n",
      "51 2.123474597930908\n",
      "52 2.120772361755371\n",
      "53 2.118116855621338\n",
      "54 2.1155037879943848\n",
      "55 2.1129307746887207\n",
      "56 2.1103944778442383\n",
      "57 2.1078927516937256\n",
      "58 2.1054229736328125\n",
      "59 2.102982759475708\n",
      "60 2.1005702018737793\n",
      "61 2.0981836318969727\n",
      "62 2.095820903778076\n",
      "63 2.0934805870056152\n",
      "64 2.0911612510681152\n",
      "65 2.0888614654541016\n",
      "66 2.0865800380706787\n",
      "67 2.084315538406372\n",
      "68 2.0820672512054443\n",
      "69 2.079833984375\n",
      "70 2.0776147842407227\n",
      "71 2.075409173965454\n",
      "72 2.073215961456299\n",
      "73 2.0710346698760986\n",
      "74 2.068864583969116\n",
      "75 2.066704750061035\n",
      "76 2.0645551681518555\n",
      "77 2.062415361404419\n",
      "78 2.06028413772583\n",
      "79 2.058161973953247\n",
      "80 2.0560476779937744\n",
      "81 2.053941249847412\n",
      "82 2.051842212677002\n",
      "83 2.049750328063965\n",
      "84 2.047665596008301\n",
      "85 2.0455877780914307\n",
      "86 2.043515920639038\n",
      "87 2.041450262069702\n",
      "88 2.039390802383423\n",
      "89 2.037336826324463\n",
      "90 2.0352888107299805\n",
      "91 2.033245801925659\n",
      "92 2.031208038330078\n",
      "93 2.0291757583618164\n",
      "94 2.0271482467651367\n",
      "95 2.025125741958618\n",
      "96 2.0231080055236816\n",
      "97 2.021095037460327\n",
      "98 2.0190863609313965\n",
      "99 2.017082691192627\n",
      "100 2.015082836151123\n",
      "101 2.013087749481201\n",
      "102 2.011096715927124\n",
      "103 2.0091099739074707\n",
      "104 2.007127285003662\n",
      "105 2.0051486492156982\n",
      "106 2.003174304962158\n",
      "107 2.001203775405884\n",
      "108 1.9992374181747437\n",
      "109 1.99727463722229\n",
      "110 1.9953160285949707\n",
      "111 1.993360996246338\n",
      "112 1.9914096593856812\n",
      "113 1.9894623756408691\n",
      "114 1.9875187873840332\n",
      "115 1.9855787754058838\n",
      "116 1.983642578125\n",
      "117 1.9817101955413818\n",
      "118 1.9797813892364502\n",
      "119 1.9778560400009155\n",
      "120 1.975934386253357\n",
      "121 1.9740164279937744\n",
      "122 1.9721016883850098\n",
      "123 1.9701907634735107\n",
      "124 1.9682832956314087\n",
      "125 1.966379165649414\n",
      "126 1.9644789695739746\n",
      "127 1.9625821113586426\n",
      "128 1.9606884717941284\n",
      "129 1.9587982892990112\n",
      "130 1.9569118022918701\n",
      "131 1.9550285339355469\n",
      "132 1.9531490802764893\n",
      "133 1.9512726068496704\n",
      "134 1.949399709701538\n",
      "135 1.9475302696228027\n",
      "136 1.9456640481948853\n",
      "137 1.9438014030456543\n",
      "138 1.9419419765472412\n",
      "139 1.9400858879089355\n",
      "140 1.9382328987121582\n",
      "141 1.9363839626312256\n",
      "142 1.934537649154663\n",
      "143 1.9326947927474976\n",
      "144 1.9308555126190186\n",
      "145 1.9290192127227783\n",
      "146 1.9271866083145142\n",
      "147 1.9253566265106201\n",
      "148 1.9235306978225708\n",
      "149 1.9217076301574707\n",
      "150 1.9198880195617676\n",
      "151 1.9180715084075928\n",
      "152 1.9162580966949463\n",
      "153 1.9144480228424072\n",
      "154 1.9126412868499756\n",
      "155 1.9108378887176514\n",
      "156 1.9090375900268555\n",
      "157 1.907240390777588\n",
      "158 1.9054465293884277\n",
      "159 1.903655767440796\n",
      "160 1.9018683433532715\n",
      "161 1.9000840187072754\n",
      "162 1.898302674293518\n",
      "163 1.8965246677398682\n",
      "164 1.8947498798370361\n",
      "165 1.8929781913757324\n",
      "166 1.8912098407745361\n",
      "167 1.889444351196289\n",
      "168 1.8876819610595703\n",
      "169 1.885923147201538\n",
      "170 1.884167194366455\n",
      "171 1.8824142217636108\n",
      "172 1.880664587020874\n",
      "173 1.8789180517196655\n",
      "174 1.8771742582321167\n",
      "175 1.8754339218139648\n",
      "176 1.8736966848373413\n",
      "177 1.871962308883667\n",
      "178 1.8702311515808105\n",
      "179 1.8685030937194824\n",
      "180 1.8667778968811035\n",
      "181 1.865056037902832\n",
      "182 1.8633370399475098\n",
      "183 1.8616209030151367\n",
      "184 1.8599083423614502\n",
      "185 1.8581984043121338\n",
      "186 1.8564915657043457\n",
      "187 1.8547875881195068\n",
      "188 1.853087067604065\n",
      "189 1.851388931274414\n",
      "190 1.8496944904327393\n",
      "191 1.8480026721954346\n",
      "192 1.846313714981079\n",
      "193 1.844628095626831\n",
      "194 1.8429452180862427\n",
      "195 1.8412652015686035\n",
      "196 1.8395881652832031\n",
      "197 1.8379144668579102\n",
      "198 1.8362433910369873\n",
      "199 1.8345752954483032\n",
      "200 1.8329102993011475\n",
      "201 1.831248164176941\n",
      "202 1.8295888900756836\n",
      "203 1.8279324769973755\n",
      "204 1.8262791633605957\n",
      "205 1.8246287107467651\n",
      "206 1.8229808807373047\n",
      "207 1.821336269378662\n",
      "208 1.8196945190429688\n",
      "209 1.8180557489395142\n",
      "210 1.8164197206497192\n",
      "211 1.8147865533828735\n",
      "212 1.8131561279296875\n",
      "213 1.8115289211273193\n",
      "214 1.8099043369293213\n",
      "215 1.8082823753356934\n",
      "216 1.8066636323928833\n",
      "217 1.8050477504730225\n",
      "218 1.8034343719482422\n",
      "219 1.8018240928649902\n",
      "220 1.8002164363861084\n",
      "221 1.7986117601394653\n",
      "222 1.7970099449157715\n",
      "223 1.7954108715057373\n",
      "224 1.7938145399093628\n",
      "225 1.7922208309173584\n",
      "226 1.7906301021575928\n",
      "227 1.7890424728393555\n",
      "228 1.7874572277069092\n",
      "229 1.785874605178833\n",
      "230 1.7842953205108643\n",
      "231 1.7827181816101074\n",
      "232 1.781144142150879\n",
      "233 1.7795727252960205\n",
      "234 1.7780041694641113\n",
      "235 1.7764381170272827\n",
      "236 1.7748749256134033\n",
      "237 1.7733147144317627\n",
      "238 1.771756887435913\n",
      "239 1.7702019214630127\n",
      "240 1.7686495780944824\n",
      "241 1.7671000957489014\n",
      "242 1.7655532360076904\n",
      "243 1.7640089988708496\n",
      "244 1.762467384338379\n",
      "245 1.7609286308288574\n",
      "246 1.759392499923706\n",
      "247 1.7578588724136353\n",
      "248 1.7563283443450928\n",
      "249 1.7547999620437622\n",
      "250 1.75327467918396\n",
      "251 1.7517516613006592\n",
      "252 1.7502315044403076\n",
      "253 1.7487138509750366\n",
      "254 1.7471988201141357\n",
      "255 1.7456865310668945\n",
      "256 1.7441768646240234\n",
      "257 1.7426698207855225\n",
      "258 1.7411651611328125\n",
      "259 1.7396633625030518\n",
      "260 1.7381641864776611\n",
      "261 1.7366676330566406\n",
      "262 1.7351734638214111\n",
      "263 1.7336819171905518\n",
      "264 1.732193112373352\n",
      "265 1.7307064533233643\n",
      "266 1.7292227745056152\n",
      "267 1.7277417182922363\n",
      "268 1.7262629270553589\n",
      "269 1.724786639213562\n",
      "270 1.7233132123947144\n",
      "271 1.7218421697616577\n",
      "272 1.7203736305236816\n",
      "273 1.7189077138900757\n",
      "274 1.7174441814422607\n",
      "275 1.715983271598816\n",
      "276 1.7145248651504517\n",
      "277 1.7130687236785889\n",
      "278 1.7116154432296753\n",
      "279 1.7101644277572632\n",
      "280 1.7087161540985107\n",
      "281 1.7072702646255493\n",
      "282 1.705826759338379\n",
      "283 1.704385757446289\n",
      "284 1.7029472589492798\n",
      "285 1.7015111446380615\n",
      "286 1.7000776529312134\n",
      "287 1.6986467838287354\n",
      "288 1.6972179412841797\n",
      "289 1.6957917213439941\n",
      "290 1.6943680047988892\n",
      "291 1.6929465532302856\n",
      "292 1.6915276050567627\n",
      "293 1.6901112794876099\n",
      "294 1.688697099685669\n",
      "295 1.6872854232788086\n",
      "296 1.6858762502670288\n",
      "297 1.68446946144104\n",
      "298 1.6830650568008423\n",
      "299 1.6816630363464355\n",
      "300 1.6802631616592407\n",
      "301 1.6788660287857056\n",
      "302 1.6774710416793823\n",
      "303 1.6760787963867188\n",
      "304 1.6746885776519775\n",
      "305 1.6733007431030273\n",
      "306 1.6719154119491577\n",
      "307 1.6705322265625\n",
      "308 1.6691516637802124\n",
      "309 1.6677731275558472\n",
      "310 1.666397213935852\n",
      "311 1.6650235652923584\n",
      "312 1.6636520624160767\n",
      "313 1.6622830629348755\n",
      "314 1.6609162092208862\n",
      "315 1.6595518589019775\n",
      "316 1.6581900119781494\n",
      "317 1.656830072402954\n",
      "318 1.655472755432129\n",
      "319 1.6541173458099365\n",
      "320 1.6527647972106934\n",
      "321 1.651413917541504\n",
      "322 1.6500657796859741\n",
      "323 1.6487199068069458\n",
      "324 1.6473759412765503\n",
      "325 1.6460344791412354\n",
      "326 1.6446951627731323\n",
      "327 1.6433582305908203\n",
      "328 1.6420234441757202\n",
      "329 1.6406910419464111\n",
      "330 1.6393609046936035\n",
      "331 1.6380330324172974\n",
      "332 1.6367073059082031\n",
      "333 1.6353834867477417\n",
      "334 1.6340622901916504\n",
      "335 1.632743239402771\n",
      "336 1.6314263343811035\n",
      "337 1.6301116943359375\n",
      "338 1.6287992000579834\n",
      "339 1.6274890899658203\n",
      "340 1.62618088722229\n",
      "341 1.6248750686645508\n",
      "342 1.6235716342926025\n",
      "343 1.622270107269287\n",
      "344 1.6209707260131836\n",
      "345 1.619673728942871\n",
      "346 1.6183786392211914\n",
      "347 1.6170858144760132\n",
      "348 1.6157952547073364\n",
      "349 1.614506721496582\n",
      "350 1.6132205724716187\n",
      "351 1.611936330795288\n",
      "352 1.6106538772583008\n",
      "353 1.6093745231628418\n",
      "354 1.6080965995788574\n",
      "355 1.606820821762085\n",
      "356 1.6055474281311035\n",
      "357 1.6042760610580444\n",
      "358 1.6030068397521973\n",
      "359 1.6017396450042725\n",
      "360 1.6004745960235596\n",
      "361 1.599211573600769\n",
      "362 1.5979509353637695\n",
      "363 1.5966919660568237\n",
      "364 1.595435380935669\n",
      "365 1.594180703163147\n",
      "366 1.5929282903671265\n",
      "367 1.5916776657104492\n",
      "368 1.590429425239563\n",
      "369 1.5891830921173096\n",
      "370 1.5879387855529785\n",
      "371 1.586696743965149\n",
      "372 1.585456371307373\n",
      "373 1.5842182636260986\n",
      "374 1.5829825401306152\n",
      "375 1.581748366355896\n",
      "376 1.5805163383483887\n",
      "377 1.5792865753173828\n",
      "378 1.5780586004257202\n",
      "379 1.57683265209198\n",
      "380 1.5756088495254517\n",
      "381 1.5743870735168457\n",
      "382 1.573167324066162\n",
      "383 1.5719493627548218\n",
      "384 1.570733666419983\n",
      "385 1.5695197582244873\n",
      "386 1.5683079957962036\n",
      "387 1.5670980215072632\n",
      "388 1.5658901929855347\n",
      "389 1.5646846294403076\n",
      "390 1.5634806156158447\n",
      "391 1.5622786283493042\n",
      "392 1.5610787868499756\n",
      "393 1.5598806142807007\n",
      "394 1.5586847066879272\n",
      "395 1.5574904680252075\n",
      "396 1.5562984943389893\n",
      "397 1.5551083087921143\n",
      "398 1.553920030593872\n",
      "399 1.5527337789535522\n",
      "400 1.5515495538711548\n",
      "401 1.5503668785095215\n",
      "402 1.5491864681243896\n",
      "403 1.5480079650878906\n",
      "404 1.5468312501907349\n",
      "405 1.5456565618515015\n",
      "406 1.5444837808609009\n",
      "407 1.5433127880096436\n",
      "408 1.5421438217163086\n",
      "409 1.5409767627716064\n",
      "410 1.5398114919662476\n",
      "411 1.5386483669281006\n",
      "412 1.5374865531921387\n",
      "413 1.5363271236419678\n",
      "414 1.5351693630218506\n",
      "415 1.5340136289596558\n",
      "416 1.5328598022460938\n",
      "417 1.5317076444625854\n",
      "418 1.53055739402771\n",
      "419 1.5294090509414673\n",
      "420 1.5282626152038574\n",
      "421 1.5271178483963013\n",
      "422 1.525975227355957\n",
      "423 1.524834156036377\n",
      "424 1.5236952304840088\n",
      "425 1.5225579738616943\n",
      "426 1.5214226245880127\n",
      "427 1.5202887058258057\n",
      "428 1.5191569328308105\n",
      "429 1.5180270671844482\n",
      "430 1.5168988704681396\n",
      "431 1.5157725811004639\n",
      "432 1.5146479606628418\n",
      "433 1.5135254859924316\n",
      "434 1.512404441833496\n",
      "435 1.5112853050231934\n",
      "436 1.5101680755615234\n",
      "437 1.5090523958206177\n",
      "438 1.5079386234283447\n",
      "439 1.5068268775939941\n",
      "440 1.5057165622711182\n",
      "441 1.5046080350875854\n",
      "442 1.5035014152526855\n",
      "443 1.502396583557129\n",
      "444 1.501293420791626\n",
      "445 1.5001921653747559\n",
      "446 1.49909245967865\n",
      "447 1.4979946613311768\n",
      "448 1.4968986511230469\n",
      "449 1.4958043098449707\n",
      "450 1.4947116374969482\n",
      "451 1.4936208724975586\n",
      "452 1.4925315380096436\n",
      "453 1.4914442300796509\n",
      "454 1.4903584718704224\n",
      "455 1.489274501800537\n",
      "456 1.4881923198699951\n",
      "457 1.4871118068695068\n",
      "458 1.4860329627990723\n",
      "459 1.4849557876586914\n",
      "460 1.4838805198669434\n",
      "461 1.48280668258667\n",
      "462 1.4817347526550293\n",
      "463 1.4806643724441528\n",
      "464 1.4795960187911987\n",
      "465 1.4785289764404297\n",
      "466 1.477463722229004\n",
      "467 1.4764001369476318\n",
      "468 1.4753384590148926\n",
      "469 1.474278211593628\n",
      "470 1.473219394683838\n",
      "471 1.4721627235412598\n",
      "472 1.4711077213287354\n",
      "473 1.4700539112091064\n",
      "474 1.4690022468566895\n",
      "475 1.4679518938064575\n",
      "476 1.4669032096862793\n",
      "477 1.4658563137054443\n",
      "478 1.4648112058639526\n",
      "479 1.4637675285339355\n",
      "480 1.4627254009246826\n",
      "481 1.4616849422454834\n",
      "482 1.4606462717056274\n",
      "483 1.459609031677246\n",
      "484 1.458573579788208\n",
      "485 1.4575397968292236\n",
      "486 1.4565074443817139\n",
      "487 1.4554767608642578\n",
      "488 1.454447627067566\n",
      "489 1.4534201622009277\n",
      "490 1.4523944854736328\n",
      "491 1.451370120048523\n",
      "492 1.4503474235534668\n",
      "493 1.4493262767791748\n",
      "494 1.4483067989349365\n",
      "495 1.4472891092300415\n",
      "496 1.446272611618042\n",
      "497 1.4452577829360962\n",
      "498 1.4442448616027832\n",
      "499 1.4432330131530762\n",
      "500 1.442223072052002\n",
      "501 1.4412145614624023\n",
      "502 1.440207600593567\n",
      "503 1.4392023086547852\n",
      "504 1.4381985664367676\n",
      "505 1.4371963739395142\n",
      "506 1.4361954927444458\n",
      "507 1.4351965188980103\n",
      "508 1.4341988563537598\n",
      "509 1.4332027435302734\n",
      "510 1.4322082996368408\n",
      "511 1.4312152862548828\n",
      "512 1.4302237033843994\n",
      "513 1.4292337894439697\n",
      "514 1.4282453060150146\n",
      "515 1.4272584915161133\n",
      "516 1.4262731075286865\n",
      "517 1.425289273262024\n",
      "518 1.424306869506836\n",
      "519 1.423326015472412\n",
      "520 1.422346830368042\n",
      "521 1.4213688373565674\n",
      "522 1.4203925132751465\n",
      "523 1.4194176197052002\n",
      "524 1.4184441566467285\n",
      "525 1.4174723625183105\n",
      "526 1.4165019989013672\n",
      "527 1.4155330657958984\n",
      "528 1.4145655632019043\n",
      "529 1.4135997295379639\n",
      "530 1.412635326385498\n",
      "531 1.4116721153259277\n",
      "532 1.4107105731964111\n",
      "533 1.4097505807876587\n",
      "534 1.4087920188903809\n",
      "535 1.407834768295288\n",
      "536 1.40687894821167\n",
      "537 1.4059247970581055\n",
      "538 1.4049720764160156\n",
      "539 1.4040207862854004\n",
      "540 1.4030706882476807\n",
      "541 1.4021222591400146\n",
      "542 1.4011752605438232\n",
      "543 1.400229573249817\n",
      "544 1.3992855548858643\n",
      "545 1.3983427286148071\n",
      "546 1.397401213645935\n",
      "547 1.3964612483978271\n",
      "548 1.3955228328704834\n",
      "549 1.3945858478546143\n",
      "550 1.3936502933502197\n",
      "551 1.3927159309387207\n",
      "552 1.3917832374572754\n",
      "553 1.390851616859436\n",
      "554 1.3899216651916504\n",
      "555 1.3889930248260498\n",
      "556 1.3880655765533447\n",
      "557 1.3871397972106934\n",
      "558 1.3862154483795166\n",
      "559 1.3852922916412354\n",
      "560 1.3843708038330078\n",
      "561 1.3834505081176758\n",
      "562 1.3825315237045288\n",
      "563 1.3816139698028564\n",
      "564 1.3806978464126587\n",
      "565 1.3797829151153564\n",
      "566 1.3788695335388184\n",
      "567 1.3779575824737549\n",
      "568 1.3770467042922974\n",
      "569 1.3761374950408936\n",
      "570 1.3752293586730957\n",
      "571 1.3743226528167725\n",
      "572 1.3734172582626343\n",
      "573 1.3725135326385498\n",
      "574 1.3716109991073608\n",
      "575 1.370709776878357\n",
      "576 1.3698095083236694\n",
      "577 1.3689109086990356\n",
      "578 1.368013858795166\n",
      "579 1.3671178817749023\n",
      "580 1.3662230968475342\n",
      "581 1.3653302192687988\n",
      "582 1.3644379377365112\n",
      "583 1.3635475635528564\n",
      "584 1.362658143043518\n",
      "585 1.3617701530456543\n",
      "586 1.3608834743499756\n",
      "587 1.3599979877471924\n",
      "588 1.359114170074463\n",
      "589 1.3582313060760498\n",
      "590 1.3573498725891113\n",
      "591 1.3564698696136475\n",
      "592 1.3555908203125\n",
      "593 1.3547130823135376\n",
      "594 1.353837013244629\n",
      "595 1.3529618978500366\n",
      "596 1.3520883321762085\n",
      "597 1.3512158393859863\n",
      "598 1.3503447771072388\n",
      "599 1.3494747877120972\n",
      "600 1.3486063480377197\n",
      "601 1.3477389812469482\n",
      "602 1.3468728065490723\n",
      "603 1.34600830078125\n",
      "604 1.3451446294784546\n",
      "605 1.3442823886871338\n",
      "606 1.343421220779419\n",
      "607 1.3425617218017578\n",
      "608 1.3417030572891235\n",
      "609 1.3408458232879639\n",
      "610 1.3399899005889893\n",
      "611 1.3391352891921997\n",
      "612 1.3382817506790161\n",
      "613 1.3374295234680176\n",
      "614 1.336578369140625\n",
      "615 1.335728645324707\n",
      "616 1.3348803520202637\n",
      "617 1.3340327739715576\n",
      "618 1.3331868648529053\n",
      "619 1.3323419094085693\n",
      "620 1.331498146057129\n",
      "621 1.330655813217163\n",
      "622 1.3298145532608032\n",
      "623 1.328974723815918\n",
      "624 1.3281359672546387\n",
      "625 1.3272984027862549\n",
      "626 1.3264620304107666\n",
      "627 1.3256268501281738\n",
      "628 1.3247931003570557\n",
      "629 1.323960304260254\n",
      "630 1.3231287002563477\n",
      "631 1.322298526763916\n",
      "632 1.3214695453643799\n",
      "633 1.3206413984298706\n",
      "634 1.319814682006836\n",
      "635 1.3189890384674072\n",
      "636 1.318164587020874\n",
      "637 1.3173414468765259\n",
      "638 1.3165196180343628\n",
      "639 1.3156986236572266\n",
      "640 1.3148789405822754\n",
      "641 1.3140605688095093\n",
      "642 1.3132431507110596\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "643 1.312427043914795\n",
      "644 1.3116121292114258\n",
      "645 1.3107982873916626\n",
      "646 1.309985637664795\n",
      "647 1.3091740608215332\n",
      "648 1.308363676071167\n",
      "649 1.3075546026229858\n",
      "650 1.306746482849121\n",
      "651 1.3059395551681519\n",
      "652 1.3051338195800781\n",
      "653 1.3043291568756104\n",
      "654 1.3035258054733276\n",
      "655 1.3027235269546509\n",
      "656 1.3019225597381592\n",
      "657 1.3011223077774048\n",
      "658 1.300323486328125\n",
      "659 1.2995257377624512\n",
      "660 1.2987290620803833\n",
      "661 1.297933578491211\n",
      "662 1.2971391677856445\n",
      "663 1.2963457107543945\n",
      "664 1.2955536842346191\n",
      "665 1.2947627305984497\n",
      "666 1.2939727306365967\n",
      "667 1.2931840419769287\n",
      "668 1.2923963069915771\n",
      "669 1.291609764099121\n",
      "670 1.2908241748809814\n",
      "671 1.2900397777557373\n",
      "672 1.2892565727233887\n",
      "673 1.288474440574646\n",
      "674 1.2876935005187988\n",
      "675 1.2869133949279785\n",
      "676 1.2861346006393433\n",
      "677 1.2853567600250244\n",
      "678 1.2845799922943115\n",
      "679 1.2838044166564941\n",
      "680 1.2830297946929932\n",
      "681 1.2822563648223877\n",
      "682 1.2814838886260986\n",
      "683 1.2807128429412842\n",
      "684 1.2799423933029175\n",
      "685 1.2791733741760254\n",
      "686 1.2784053087234497\n",
      "687 1.2776384353637695\n",
      "688 1.2768723964691162\n",
      "689 1.2761074304580688\n",
      "690 1.2753437757492065\n",
      "691 1.274580955505371\n",
      "692 1.2738194465637207\n",
      "693 1.2730586528778076\n",
      "694 1.27229905128479\n",
      "695 1.2715404033660889\n",
      "696 1.2707831859588623\n",
      "697 1.270026683807373\n",
      "698 1.2692714929580688\n",
      "699 1.268517017364502\n",
      "700 1.2677637338638306\n",
      "701 1.2670114040374756\n",
      "702 1.2662603855133057\n",
      "703 1.2655102014541626\n",
      "704 1.264761209487915\n",
      "705 1.2640129327774048\n",
      "706 1.26326584815979\n",
      "707 1.2625199556350708\n",
      "708 1.2617747783660889\n",
      "709 1.261030912399292\n",
      "710 1.2602877616882324\n",
      "711 1.2595460414886475\n",
      "712 1.2588050365447998\n",
      "713 1.2580652236938477\n",
      "714 1.2573262453079224\n",
      "715 1.2565882205963135\n",
      "716 1.2558515071868896\n",
      "717 1.2551155090332031\n",
      "718 1.2543808221817017\n",
      "719 1.2536470890045166\n",
      "720 1.2529139518737793\n",
      "721 1.252182126045227\n",
      "722 1.2514512538909912\n",
      "723 1.2507214546203613\n",
      "724 1.2499923706054688\n",
      "725 1.2492647171020508\n",
      "726 1.248537540435791\n",
      "727 1.2478116750717163\n",
      "728 1.247086763381958\n",
      "729 1.2463628053665161\n",
      "730 1.2456399202346802\n",
      "731 1.244917869567871\n",
      "732 1.244196891784668\n",
      "733 1.2434768676757812\n",
      "734 1.242757797241211\n",
      "735 1.2420399188995361\n",
      "736 1.2413227558135986\n",
      "737 1.2406067848205566\n",
      "738 1.2398914098739624\n",
      "739 1.2391774654388428\n",
      "740 1.2384638786315918\n",
      "741 1.237751841545105\n",
      "742 1.2370405197143555\n",
      "743 1.236330270767212\n",
      "744 1.2356207370758057\n",
      "745 1.234912395477295\n",
      "746 1.2342050075531006\n",
      "747 1.2334983348846436\n",
      "748 1.232792854309082\n",
      "749 1.232088327407837\n",
      "750 1.2313846349716187\n",
      "751 1.2306818962097168\n",
      "752 1.2299799919128418\n",
      "753 1.2292791604995728\n",
      "754 1.2285792827606201\n",
      "755 1.2278801202774048\n",
      "756 1.227182149887085\n",
      "757 1.226485013961792\n",
      "758 1.2257885932922363\n",
      "759 1.2250936031341553\n",
      "760 1.2243993282318115\n",
      "761 1.2237058877944946\n",
      "762 1.2230132818222046\n",
      "763 1.22232186794281\n",
      "764 1.2216310501098633\n",
      "765 1.220941424369812\n",
      "766 1.2202526330947876\n",
      "767 1.21956467628479\n",
      "768 1.2188776731491089\n",
      "769 1.2181916236877441\n",
      "770 1.2175064086914062\n",
      "771 1.2168222665786743\n",
      "772 1.2161388397216797\n",
      "773 1.215456485748291\n",
      "774 1.2147749662399292\n",
      "775 1.2140942811965942\n",
      "776 1.2134146690368652\n",
      "777 1.212735652923584\n",
      "778 1.2120575904846191\n",
      "779 1.2113807201385498\n",
      "780 1.2107045650482178\n",
      "781 1.2100292444229126\n",
      "782 1.2093548774719238\n",
      "783 1.208681344985962\n",
      "784 1.2080085277557373\n",
      "785 1.2073369026184082\n",
      "786 1.206666111946106\n",
      "787 1.205996036529541\n",
      "788 1.205327033996582\n",
      "789 1.2046587467193604\n",
      "790 1.2039915323257446\n",
      "791 1.2033250331878662\n",
      "792 1.2026596069335938\n",
      "793 1.2019946575164795\n",
      "794 1.2013307809829712\n",
      "795 1.2006678581237793\n",
      "796 1.2000056505203247\n",
      "797 1.199344515800476\n",
      "798 1.1986839771270752\n",
      "799 1.1980246305465698\n",
      "800 1.1973657608032227\n",
      "801 1.1967079639434814\n",
      "802 1.1960511207580566\n",
      "803 1.1953949928283691\n",
      "804 1.194739580154419\n",
      "805 1.1940851211547852\n",
      "806 1.1934316158294678\n",
      "807 1.1927789449691772\n",
      "808 1.192126989364624\n",
      "809 1.1914761066436768\n",
      "810 1.1908258199691772\n",
      "811 1.1901764869689941\n",
      "812 1.189527988433838\n",
      "813 1.1888803243637085\n",
      "814 1.1882333755493164\n",
      "815 1.1875874996185303\n",
      "816 1.1869423389434814\n",
      "817 1.1862980127334595\n",
      "818 1.1856545209884644\n",
      "819 1.1850117444992065\n",
      "820 1.1843700408935547\n",
      "821 1.1837289333343506\n",
      "822 1.183088779449463\n",
      "823 1.1824493408203125\n",
      "824 1.1818106174468994\n",
      "825 1.1811730861663818\n",
      "826 1.1805360317230225\n",
      "827 1.1798999309539795\n",
      "828 1.1792646646499634\n",
      "829 1.1786302328109741\n",
      "830 1.1779966354370117\n",
      "831 1.177363634109497\n",
      "832 1.1767315864562988\n",
      "833 1.1761003732681274\n",
      "834 1.1754698753356934\n",
      "835 1.1748402118682861\n",
      "836 1.1742113828659058\n",
      "837 1.1735832691192627\n",
      "838 1.1729559898376465\n",
      "839 1.1723296642303467\n",
      "840 1.1717039346694946\n",
      "841 1.171079158782959\n",
      "842 1.1704552173614502\n",
      "843 1.1698317527770996\n",
      "844 1.169209599494934\n",
      "845 1.1685876846313477\n",
      "846 1.1679667234420776\n",
      "847 1.167346477508545\n",
      "848 1.1667273044586182\n",
      "849 1.1661088466644287\n",
      "850 1.1654911041259766\n",
      "851 1.1648739576339722\n",
      "852 1.1642577648162842\n",
      "853 1.163642168045044\n",
      "854 1.1630277633666992\n",
      "855 1.1624139547348022\n",
      "856 1.1618008613586426\n",
      "857 1.1611884832382202\n",
      "858 1.1605768203735352\n",
      "859 1.159965991973877\n",
      "860 1.159355878829956\n",
      "861 1.1587467193603516\n",
      "862 1.1581382751464844\n",
      "863 1.157530426979065\n",
      "864 1.1569234132766724\n",
      "865 1.1563172340393066\n",
      "866 1.1557116508483887\n",
      "867 1.155107021331787\n",
      "868 1.1545031070709229\n",
      "869 1.153899908065796\n",
      "870 1.1532971858978271\n",
      "871 1.1526957750320435\n",
      "872 1.1520947217941284\n",
      "873 1.1514945030212402\n",
      "874 1.150895118713379\n",
      "875 1.1502963304519653\n",
      "876 1.149698257446289\n",
      "877 1.1491011381149292\n",
      "878 1.148504614830017\n",
      "879 1.1479090452194214\n",
      "880 1.1473138332366943\n",
      "881 1.1467196941375732\n",
      "882 1.1461260318756104\n",
      "883 1.1455333232879639\n",
      "884 1.1449410915374756\n",
      "885 1.1443499326705933\n",
      "886 1.1437593698501587\n",
      "887 1.1431694030761719\n",
      "888 1.142580270767212\n",
      "889 1.1419917345046997\n",
      "890 1.141404151916504\n",
      "891 1.1408172845840454\n",
      "892 1.1402308940887451\n",
      "893 1.1396453380584717\n",
      "894 1.1390604972839355\n",
      "895 1.1384766101837158\n",
      "896 1.1378930807113647\n",
      "897 1.13731050491333\n",
      "898 1.1367286443710327\n",
      "899 1.1361472606658936\n",
      "900 1.1355668306350708\n",
      "901 1.1349869966506958\n",
      "902 1.1344077587127686\n",
      "903 1.1338293552398682\n",
      "904 1.1332517862319946\n",
      "905 1.1326746940612793\n",
      "906 1.1320984363555908\n",
      "907 1.1315228939056396\n",
      "908 1.1309481859207153\n",
      "909 1.1303739547729492\n",
      "910 1.12980055809021\n",
      "911 1.129227638244629\n",
      "912 1.1286556720733643\n",
      "913 1.1280841827392578\n",
      "914 1.1275135278701782\n",
      "915 1.126943588256836\n",
      "916 1.1263742446899414\n",
      "917 1.1258058547973633\n",
      "918 1.1252378225326538\n",
      "919 1.1246705055236816\n",
      "920 1.1241040229797363\n",
      "921 1.1235382556915283\n",
      "922 1.1229729652404785\n",
      "923 1.1224086284637451\n",
      "924 1.12184476852417\n",
      "925 1.1212815046310425\n",
      "926 1.1207189559936523\n",
      "927 1.120157241821289\n",
      "928 1.119596242904663\n",
      "929 1.1190357208251953\n",
      "930 1.1184760332107544\n",
      "931 1.1179170608520508\n",
      "932 1.1173585653305054\n",
      "933 1.1168007850646973\n",
      "934 1.1162437200546265\n",
      "935 1.1156872510910034\n",
      "936 1.1151317358016968\n",
      "937 1.1145764589309692\n",
      "938 1.114022135734558\n",
      "939 1.1134684085845947\n",
      "940 1.112915277481079\n",
      "941 1.1123629808425903\n",
      "942 1.1118111610412598\n",
      "943 1.1112600564956665\n",
      "944 1.1107097864151\n",
      "945 1.1101598739624023\n",
      "946 1.109610915184021\n",
      "947 1.1090621948242188\n",
      "948 1.108514428138733\n",
      "949 1.1079672574996948\n",
      "950 1.107420563697815\n",
      "951 1.1068750619888306\n",
      "952 1.1063296794891357\n",
      "953 1.1057851314544678\n",
      "954 1.105241060256958\n",
      "955 1.1046979427337646\n",
      "956 1.1041553020477295\n",
      "957 1.1036133766174316\n",
      "958 1.1030720472335815\n",
      "959 1.1025311946868896\n",
      "960 1.101991057395935\n",
      "961 1.1014518737792969\n",
      "962 1.1009130477905273\n",
      "963 1.1003748178482056\n",
      "964 1.099837064743042\n",
      "965 1.0993002653121948\n",
      "966 1.0987639427185059\n",
      "967 1.0982284545898438\n",
      "968 1.0976934432983398\n",
      "969 1.0971590280532837\n",
      "970 1.0966253280639648\n",
      "971 1.0960922241210938\n",
      "972 1.0955595970153809\n",
      "973 1.0950278043746948\n",
      "974 1.094496488571167\n",
      "975 1.0939658880233765\n",
      "976 1.0934360027313232\n",
      "977 1.0929064750671387\n",
      "978 1.092377781867981\n",
      "979 1.091849684715271\n",
      "980 1.0913220643997192\n",
      "981 1.0907952785491943\n",
      "982 1.0902687311172485\n",
      "983 1.0897431373596191\n",
      "984 1.0892181396484375\n",
      "985 1.088693618774414\n",
      "986 1.0881696939468384\n",
      "987 1.0876463651657104\n",
      "988 1.0871238708496094\n",
      "989 1.086601972579956\n",
      "990 1.0860804319381714\n",
      "991 1.0855594873428345\n",
      "992 1.085039496421814\n",
      "993 1.084519863128662\n",
      "994 1.084000825881958\n",
      "995 1.083482265472412\n",
      "996 1.0829646587371826\n",
      "997 1.0824472904205322\n",
      "998 1.0819306373596191\n",
      "999 1.0814146995544434\n"
     ]
    }
   ],
   "source": [
    "for epoch in range(1000):\n",
    "    y_pred=model(x_data)\n",
    "    loss=criterion(y_pred,y_data)\n",
    "    print(epoch,loss.item())\n",
    "    \n",
    "    optimizer.zero_grad()\n",
    "    loss.backward()\n",
    "    optimizer.step()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-10-19T11:52:46.045706Z",
     "start_time": "2020-10-19T11:52:45.836200Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/root/anaconda3/envs/mytorch/lib/python3.8/site-packages/torch/nn/functional.py:1625: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.\n",
      "  warnings.warn(\"nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.\")\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAfQUlEQVR4nO3deXxU5d3+8c83k4WQsAcihC2sEgQFwuLaoLigtdTWPi7VWtGitrbautTfr31Ka9unT1ttXWpV3LVVtK5YaV2gUVxQQECBAAHCEoJAWBKyZzL380cGDSFICDM5s1zv14tXcs6cmbluhlzcOTPnHHPOISIi0S/B6wAiIhIaKnQRkRihQhcRiREqdBGRGKFCFxGJEYlePXFGRoYbOHBgm+5bWVlJWlpaaANFOI05PmjM8eFoxrxkyZJS51zPlm7zrNAHDhzI4sWL23Tf/Px88vLyQhsowmnM8UFjjg9HM2Yz23So27TLRUQkRqjQRURihApdRCRGqNBFRGKECl1EJEYcttDN7FEz22FmKw5xu5nZPWa2zsw+MbOxoY8pIiKH05oZ+uPAOV9y+1RgaPDPDOD+o48lIiJH6rCfQ3fOvWNmA79kk2nAk67xPLwLzayrmfV2zm0LVUgRiS7OOeoaAjQE3MF/nMPf4Ag4hz/g2FoRoGBb+QG3t3i/gM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fAicJLHmdrTdjPrDRD8uiMUDxpthb4IGGpm2WaWTOObKHM8zhRWZmY07lctcM79yes84eac+3/Oub7OuYE0vr7znXMxP3Nzzn0GbDGz4cFVZwCrPIwUbpuBSWbWMfhv/Axi+E3gFswBrgh+fwXwSigeNDEUD9JenHN+M7seeJ3Gd8Ufdc6t9DhWuJ0MXA58ambLguv+v3NurneRJEx+CPw9OFnZAFzpcZ6wcc59aGbPAx/T+EmupcToKQDM7BkgD8gws2JgJvC/wHNmdhWN/7l9KyTPpUP/RURiQ7TtchERkUNQoYuIxAgVuohIjFChi4jECBW6iEiMUKGLiMQIFbqISIz4P+y7k6CkTsu4AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "x=np.linspace(0,10,200)\n",
    "x_t=torch.Tensor(x).view(200,1)\n",
    "y_t=model(x_t)\n",
    "\n",
    "y=y_t.data.numpy()\n",
    "plt.plot(x,y)\n",
    "plt.grid()\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
